<!--
 * @Author: 丨小小风离丨
 * @Date: 2023-04-28 16:33:51
 * @LastEditTime: 2023-05-25 15:51:36
 * @LastEditors: 丨小小风离丨
 * @Description: 
-->
<template>
  <div style="width: 200px">
    <el-form label-position="top" label-width="80px" :model="formData">
      <el-form-item label="名称">
        <el-input v-model="formData.name"></el-input>
      </el-form-item>
      <el-form-item label="活动区域">
        <el-select v-model="formData.region" placeholder="活动区域">
          <el-option label="上海" value="shanghai"></el-option>
          <el-option label="北京" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="即时配送" prop="delivery">
        <el-switch v-model="formData.delivery"></el-switch>
      </el-form-item>
      <el-form-item label="活动形式">
        <el-input v-model="formData.type"></el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Object,
      default: ''
    }
  },
  computed: {
    formData: {
      get() {
        let _this = this
        return new Proxy(this.value,{
          set(obj,name,val) {
            _this.$emit('update:value', {
              ...obj,
              [name]: val
            })
            return true
          }
        }) 
      }
    }
  }
}
</script>
